package entity

import (
	"time"

	"github.com/google/uuid"
	"gorm.io/gorm"
)

type HisotryTrigger struct {
	ID          string    `json:"id" gorm:"column:id"`
	WorkflowID  string    `json:"workflow_id" gorm:"workflow_id"`
	Type        string    `json:"type" gorm:"column:type"`
	Raw         string    `json:"raw" gorm:"column:raw"`
	InputParams string    `json:"input_params" gorm:"column:input_params"`
	CreatedAt   time.Time `json:"created_at" gorm:"column:created_at"`
}

func (h *HisotryTrigger) TableName() string {
	return "history_trigger"
}

func (h *HisotryTrigger) BeforeCreate(tx *gorm.DB) (err error) {
	h.ID = uuid.NewString()
	return
}
